package ligacao;

import br.edu.fvs.principal.R;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

public class ExemploFazLigacao extends Activity implements OnClickListener {
	Button botaoLigar;
	EditText campoNumero;

	public void onCreate(Bundle icicle) {
		super.onCreate(icicle);
		setContentView(R.layout.form_fazligacao);
		botaoLigar = (Button) findViewById(R.id.btLigar);
		botaoLigar.setOnClickListener(this);
		campoNumero = (EditText) findViewById(R.id.campoNumero);
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		if (v == botaoLigar) {
			Uri uri = Uri.parse("tel:" + campoNumero.getText().toString());
			Intent it = new Intent(Intent.ACTION_CALL, uri);
			startActivity(it);
		}
	}
}
